/**
 * 钱包API接口
 */
import api from '@/api/request'

let domain = ''
let wallet = {}

// 登录
export const getWallet = function (data) {
  return api.get(`${domain}api/v2/account/listAccounts`, {
    data,
    cancel:false
  })
}

// 查询BTC汇率价格
export const getBtcPrice = function (data) {
  return api.get(`${domain}api/v2/account2/btcPrice`, {
    data,
    cancel:false
  })
}

// 查询USDT估值
export const gettTotalUSDTAmount = function (data) {
    return api.get(`${domain}api/v2/account2/gettTotalUSDTAmount`, {
      data,
    })
}

//获得邀请用户手续费返佣
export const getUserInvitedFeeCommission  = function (uid) {
    return api.get(`${domain}/api/v5/user/invite/findUserInvitedFeeCommission?toAccountId=${uid}`, {})
}

// 充值/提现记录 direction: 1 充值、2 提现
export const listDepositHistory = function (data) {
    return api.post(`${domain}/api/v2/account/showHistory`, {
        data,
    })
}

// 查询EOS钱包地址
export const getEosAddress = function (data) {
    return api.get(`${domain}api/v2/account2/eos_main`, {
        data,
    })
}

// 提现
export const withdraw = function (data) {
    return api.post(`${domain}api/v2/account/withdraw`, {
      data,
      showLoading: true
    })
}

// 提现地址列表 /api/v2/account2/linton/withdraw/address
export const addressList = function (data) {
    return api.post(`${domain}api/v2/account2/common/withdraw/address/list`, {
        data,
    })
}

// 新增提现地址
export const addAddress = function (data) {
    return api.post(`${domain}api/v2/account2/common/withdraw/address/add`, {
        data,
        showLoading: true
    })
}
  
// 删除提现地址
export const deleteAddress = function (withdrawId) {
    return api.del(`${domain}api/v2/account2/common/withdraw/address/delete/${withdrawId}`, {
        showLoading: true
    })
}

// POST /默认兑换市场 
export const exchangeDefaultMarket = function (data) {
    return api.post(`${domain}api/v2/account2/exchangeDefaultMarket`, {
        data,
    })
}

// POST POST /exchangeMarket 兑换市场
export const exchangeMarket = function (data) {
    return api.post(`${domain}api/v2/account2/exchangeMarket`, {
        data,
    })
}
// POST /exchange 钱包闪兑
export const setExchange = function (data) {
    return api.post(`${domain}api/v2/account2/exchange`, {
        data,
        showLoading: true
    })
}

// 发送邮件 - 激活邮箱
export const reSendEmail = function (data) {
    return api.post(`${domain}api/v2/user/sendEmail`, {
        data,
        showLoading: true
    })
}